package edu.zut.pojo;

import java.util.List;

public class Page<T> {

    private int currentPage;//当前第几页
    private int count;//总记录数
    private int pageSize;//每页展示多少条数据
    private int pageCount;//总页数
    //总记录
    private List<T> list;

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPageCount() {
        if (count % pageSize == 0)
            pageCount = count / pageSize;
        else
            pageCount = count / pageSize + 1;
        return pageCount;
    }

    public void setPageCount(int pageCount) {
        this.pageCount = pageCount;
    }

    @Override
    public String toString() {
        return "Page{" +
                "currentPage=" + currentPage +
                ", count=" + count +
                ", pageSize=" + pageSize +
                ", pageCount=" + pageCount +
                ", list=" + list +
                '}';
    }
}
